using Coding4Fun.Phone.Controls;
using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.Scene;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
namespace MicroMsg.UI.UserContrl
{
	public class MMInputer : UserControl
	{
		public delegate void ListItemClick(object sender, object object_0);
		private const string TAG = "MMInputer";
		public const string cStrHandleVoiceByParent = "HandleVoiceByParent";
		private const int cNSmileyHeight = 455;
		private const int cNSmileyContentHeight = 455;
		private const int OldListHeight = 604;
		private const int OldSmileyHeight = 455;
		private bool mBIsFirstLoaded = true;
		private bool isInputFocus;
		private bool mBIsVoiceSwitchTouchHandled;
		private bool isVoiceRecordStart;
		private string mStrVoiceUser = "";
		private DispatcherTimer voiceSoundTimer;
		private DispatcherTimer voiceLimitTimer;
		private Popup popVoiceHintBlock;
		private bool isSmileyIconShow = true;
		private ChatInputMode mCuInputMode = ChatInputMode.InputDefault;
		private bool mIsDelayShowSmiley;
		private double mSipHeight;
		private bool isCurrentVoiceIcon;
		private bool mBIsSipStarted;
		private Popup mPopSmileyView;
		private double mDNowTranslayte;
		public SmileyOverlay SmileyView;
		public bool bIsWithoutArtSmiley;
		public static readonly DependencyProperty TranslateYProperty = DependencyProperty.Register("TranslateY", typeof(double), typeof(MMInputer), new PropertyMetadata(0.0, new PropertyChangedCallback(MMInputer.OnRenderXPropertyChanged)));
		private bool mBIsSetBackKey;
		private PhoneApplicationPage mPage;
		internal StackPanel inputBk;
		internal RoundButton VoiceSwitchBtn;
		internal Grid gridInputArea;
		internal VoiceInputButton VoiceSend;
		internal ChatInputTextBox inputTxt;
		internal Grid gridInputBoxCover;
		internal RoundButton SmileySwitchBtn;
		internal VoiceHint VoiceHintBlock;
		private bool _contentLoaded;
		public event MMUIEvent mDlgOnRealBoxGotFocus;
		public event MMUIEvent mDlgOnRealBoxLostFocus;
		public event MMUIEvent mDlgOnStartPushPage;
		public event MMUIEvent mDlgOnEndPushPage;
		public event MMUIEvent mDlgOnInputerModeChange;
		public event MMUIEvent mDlgBtnSendText;
		public event MMUIEvent mDlgInputAtMember;
		public event MMUIEvent mDlgVoiceInputStarted;
		public event MMUIEvent mDlgVoiceInputEnd;
		public event MMUIEvent mDlgVoiceFocusChanged;
		public event MMInputer.ListItemClick ItemClick;
		public double TranslateY
		{
			get
			{
				return (double)base.GetValue(MMInputer.TranslateYProperty);
			}
			set
			{
				base.SetValue(MMInputer.TranslateYProperty, value);
			}
		}
		public MMInputer()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.Control_Loaded));
			base.add_Unloaded(new RoutedEventHandler(this.Control_Unloaded));
			this.inputTxt.add_GotFocus(new RoutedEventHandler(this.inputTxt_GotFocus));
			this.inputTxt.add_LostFocus(new RoutedEventHandler(this.inputTxt_LostFocus));
			this.initVoiceHintPop();
			this.VoiceSend.OnFocusFieldChange += new VoiceInputButton.VoiceButtonFocusFieldChange(this.VoiceSend_OnFocusFieldChange);
		}
		private void Control_Loaded(object sender, RoutedEventArgs e)
		{
			this.BindToKeyboardFocus();
			this.setBackKeyHandler();
		}
		private void Control_Unloaded(object sender, RoutedEventArgs e)
		{
			this.VoiceRecordEnd(false);
			this.UnBindToKeyboardFocus();
			this.unSetBackKeyHandler();
			this.clearCurrPage();
		}
		private void btnLayoutRoot_Click(object sender, RoutedEventArgs e)
		{
		}
		private void inputTxt_Tap(object sender, GestureEventArgs e)
		{
			this.SwitchMode(ChatInputMode.InputTxtMode, false);
			base.UpdateLayout();
			this.gridInputBoxCover.set_Visibility(1);
			Log.smethod_5("MMInputer", "inputTxt_Tap:");
		}
		private void inputTxt_LostFocus(object sender, RoutedEventArgs e)
		{
			this.isInputFocus = false;
			this.gridInputBoxCover.set_Visibility(0);
			object focusedElement = FocusManager.GetFocusedElement();
			if (this.mCuInputMode == ChatInputMode.InputTxtMode && focusedElement != this.SmileySwitchBtn)
			{
				this.SwitchMode(ChatInputMode.InputDefault, false);
			}
		}
		private void inputTxt_GotFocus(object sender, RoutedEventArgs e)
		{
			this.isInputFocus = true;
			this.gridInputBoxCover.set_Visibility(1);
		}
		private void SmileySwitchBtn_Click(object sender, RoutedEventArgs e)
		{
			this.DoSmileySwitchBtnEvent();
		}
		private void DoSmileySwitchBtnEvent()
		{
			this.inputTxt.set_IsEnabled(false);
			this.inputTxt.set_IsEnabled(true);
			if (this.mCuInputMode == ChatInputMode.InputSmileyMode)
			{
				this.SwitchMode(ChatInputMode.InputTxtMode, false);
				return;
			}
			this.SwitchMode(ChatInputMode.InputSmileyMode, false);
		}
		private void VoiceSwitchBtn_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
		{
			this.mBIsVoiceSwitchTouchHandled = false;
		}
		private void VoiceSwitchBtn_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
		{
			if (this.mBIsVoiceSwitchTouchHandled)
			{
				return;
			}
			this.mBIsVoiceSwitchTouchHandled = true;
			this.DoVoiceSwitchBtnEvent();
			Log.smethod_5("MMInputer", "VoiceSwitchBtn_MouseLeave");
		}
		private void VoiceSwitchBtn_Click(object sender, RoutedEventArgs e)
		{
			Log.smethod_5("MMInputer", "VoiceSwitchBtn_Click");
			if (this.mBIsVoiceSwitchTouchHandled)
			{
				return;
			}
			this.mBIsVoiceSwitchTouchHandled = true;
			this.DoVoiceSwitchBtnEvent();
		}
		private void DoVoiceSwitchBtnEvent()
		{
			if (this.mCuInputMode == ChatInputMode.InputVoiceMode)
			{
				this.SwitchMode(ChatInputMode.InputTxtMode, false);
				return;
			}
			this.SwitchMode(ChatInputMode.InputVoiceMode, false);
		}
		private void inputTxt_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.get_Key() == 3)
			{
				this.DoSend();
				e.set_Handled(true);
			}
		}
		private void DoSend()
		{
			string text = this.inputTxt.Text;
			if (this.inputTxt == null)
			{
				return;
			}
			if (!string.IsNullOrWhiteSpace(text))
			{
				this.inputTxt.Text = "";
				if (this.SmileyView != null)
				{
					this.SmileyView.ClearSmileyStack();
				}
				bool flag = false;
				string object_ = EmojiManager.GetInstance().ConvertInputStrToCodeStr(text, ref flag);
				if (this.mDlgBtnSendText != null)
				{
					this.mDlgBtnSendText(this, object_);
					return;
				}
			}
			else
			{
				if (this.mDlgBtnSendText != null)
				{
					this.mDlgBtnSendText(this, "");
				}
				MessageBoxManager.ShowToast(strings.ChatEmptyTxtHint, 2500, null, false);
			}
		}
		private void VoiceSend_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
		{
			Log.smethod_5("MMInputer", "VoiceSend_ManipulationStarted");
			ChatPageCtrl.ReadyToRecord();
			this.VoiceRecordStart();
		}
		private void VoiceSend_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
		{
			Log.smethod_5("MMInputer", "VoiceSend_ManipulationCompleted");
			if (this.VoiceSend.nowLocate == VoiceInputButton.focusLocate.inCancel)
			{
				this.VoiceRecordEnd(true);
				return;
			}
			this.VoiceRecordEnd(false);
		}
		private void VoiceSend_OnFocusFieldChange(object sender, FocusFieldArgs focusFieldArgs_0)
		{
			if (focusFieldArgs_0.nowLoc == VoiceInputButton.focusLocate.inButton)
			{
				this.VoiceHintBlock.CuState = VoiceHint.State.Show;
				this.popVoiceHintBlock.set_HorizontalOffset(100.0);
				return;
			}
			if (focusFieldArgs_0.nowLoc == VoiceInputButton.focusLocate.inOther)
			{
				this.VoiceHintBlock.CuState = VoiceHint.State.CancelTip;
				this.popVoiceHintBlock.set_HorizontalOffset(30.0);
				return;
			}
			if (focusFieldArgs_0.nowLoc == VoiceInputButton.focusLocate.inCancel)
			{
				this.VoiceHintBlock.CuState = VoiceHint.State.CancelComfirm;
				this.popVoiceHintBlock.set_HorizontalOffset(30.0);
			}
		}
		public void VoiceRecordStart()
		{
			if (this.mDlgVoiceInputStarted == null)
			{
				return;
			}
			string cuUser = (string)this.mDlgVoiceInputStarted(null, null);
			this.mStrVoiceUser = cuUser;
			if (string.IsNullOrEmpty(cuUser))
			{
				return;
			}
			Log.smethod_5("MMInputer", "VoiceRecordStart");
			this.showVoiceHint();
			this.VoiceHintBlock.set_Visibility(0);
			base.UpdateLayout();
			this.VoiceHintBlock.CuState = VoiceHint.State.Prepare;
			this.VoiceSend.set_Content(strings.ChatVoiceClickText);
			base.get_Dispatcher().BeginInvoke(delegate
			{
				if (this.isVoiceRecordStart)
				{
					return;
				}
				this.isVoiceRecordStart = true;
				Log.smethod_5("MMInputer", "ServiceCenter.sceneUploadVoice.doSceneBegin");
				if ("HandleVoiceByParent" != cuUser)
				{
					ServiceCenter.sceneUploadVoice.doSceneBegin(cuUser);
				}
				this.voiceSoundTimer = new DispatcherTimer();
				this.voiceSoundTimer.set_Interval(new TimeSpan(0, 0, 0, 0, 1500));
				this.voiceSoundTimer.Start();
				this.VoiceHintBlock.SignWeight = 1;
				this.voiceSoundTimer.add_Tick(new EventHandler(this.Sound_Tick));
				this.voiceLimitTimer = new DispatcherTimer();
				this.voiceLimitTimer.set_Interval(new TimeSpan(0, 0, 0, 60));
				this.voiceLimitTimer.Start();
				this.voiceLimitTimer.add_Tick(new EventHandler(this.voiceLimitTimer_Tick));
				this.VoiceHintBlock.CuState = VoiceHint.State.Show;
			});
		}
		private void voiceLimitTimer_Tick(object sender, EventArgs e)
		{
			this.ShowVoiceTooLong();
			this.VoiceRecordEnd(false);
		}
		public void VoiceRecordEnd(bool isCancelled = false)
		{
			if (this.mDlgVoiceInputEnd != null)
			{
				this.mDlgVoiceInputEnd(null, isCancelled);
			}
			this.VoiceSend.set_Content(strings.ChatVoiceNormalText);
			this.VoiceHintBlock.CuState = VoiceHint.State.Hide;
			this.hideVoiceHint();
			Log.smethod_5("MMInputer", "VoiceRecordEnd");
			base.get_Dispatcher().BeginInvoke(delegate
			{
				if (!this.isVoiceRecordStart)
				{
					return;
				}
				this.isVoiceRecordStart = false;
				this.voiceSoundTimer.Stop();
				this.voiceSoundTimer = null;
				this.voiceLimitTimer.Stop();
				this.voiceLimitTimer = null;
				Log.smethod_5("MMInputer", "ServiceCenter.sceneUploadVoice.doSceneEnd");
				if (this.mStrVoiceUser != "HandleVoiceByParent" && !ServiceCenter.sceneUploadVoice.doSceneEnd(isCancelled))
				{
					Log.smethod_5("MMInputer", "ShowVoiceError");
					this.ShowVoiceError();
				}
				this.VoiceHintBlock.CuState = VoiceHint.State.Hide;
			});
		}
		private void Sound_Tick(object sender, EventArgs e)
		{
			if (this.VoiceHintBlock.SignWeight >= 8)
			{
				this.VoiceHintBlock.SignWeight = 1;
				return;
			}
			this.VoiceHintBlock.SignWeight++;
		}
		private void ShowVoiceError()
		{
			MessageBoxManager.ShowToast(strings.ChatVoiceSendTooShort, 2500, null, false);
		}
		private void ShowVoiceTooLong()
		{
			MessageBoxManager.ShowToast(strings.ChatVoiceSendTooLong, 2500, null, false);
		}
		private void initVoiceHintPop()
		{
			Panel panel = this.VoiceHintBlock.get_Parent() as Panel;
			panel.get_Children().Remove(this.VoiceHintBlock);
			this.popVoiceHintBlock = new Popup();
			double arg_39_0 = this.popVoiceHintBlock.get_Width();
			this.popVoiceHintBlock.set_Width(double.NaN);
			this.popVoiceHintBlock.set_HorizontalAlignment(1);
			this.VoiceHintBlock.set_HorizontalAlignment(1);
			this.popVoiceHintBlock.set_Child(this.VoiceHintBlock);
			this.popVoiceHintBlock.set_VerticalOffset(300.0);
			this.popVoiceHintBlock.set_HorizontalOffset(100.0);
			this.popVoiceHintBlock.UpdateLayout();
		}
		private void showVoiceHint()
		{
			if (this.popVoiceHintBlock == null)
			{
				this.initVoiceHintPop();
			}
			this.popVoiceHintBlock.set_IsOpen(true);
			this.popVoiceHintBlock.set_HorizontalOffset(100.0);
		}
		private void hideVoiceHint()
		{
			if (this.VoiceHintBlock == null)
			{
				return;
			}
			this.popVoiceHintBlock.set_IsOpen(false);
		}
		private void InputTxt_AtMember(object sender, object object_0)
		{
			if (this.mDlgInputAtMember != null)
			{
				this.mDlgInputAtMember(sender, object_0);
			}
		}
		private void ShowSmileyIcon(bool showSmileyIcon)
		{
			if (showSmileyIcon == this.isSmileyIconShow)
			{
				return;
			}
			if (showSmileyIcon)
			{
				this.SmileySwitchBtn.ImageSource = (new ImageSourceConverter().ConvertFromString("/Resource/Img/Chat/expression.png") as ImageSource);
			}
			else
			{
				this.SmileySwitchBtn.ImageSource = (new ImageSourceConverter().ConvertFromString("/Resource/Img/Chat/keyboard.png") as ImageSource);
			}
			this.isSmileyIconShow = showSmileyIcon;
		}
		public ChatInputMode GetMode()
		{
			return this.mCuInputMode;
		}
		public void SwitchMode(ChatInputMode mode, bool mBNotFocusTxt = false)
		{
			if (this.mCuInputMode == mode)
			{
				return;
			}
			if (this.mDlgOnInputerModeChange != null)
			{
				this.mDlgOnInputerModeChange(null, mode);
			}
			this.mCuInputMode = mode;
			switch (mode)
			{
			case ChatInputMode.InputTxtMode:
				this.ShowSmileyIcon(true);
				this.inputTxt.set_Visibility(0);
				this.VoiceSend.set_Visibility(1);
				this.gridInputBoxCover.set_Visibility(0);
				this.SetVoiceIcon(false);
				this.sipStart();
				if (!mBNotFocusTxt && this.inputTxt.realBox != null)
				{
					this.inputTxt.FocusRealBox();
				}
				this.hideSmileyPopUp();
				break;
			case ChatInputMode.InputVoiceMode:
				this.ShowSmileyIcon(true);
				this.inputTxt.set_Visibility(1);
				this.VoiceSend.set_Visibility(0);
				this.gridInputBoxCover.set_Visibility(1);
				this.hideSmileyPopUp();
				this.sipEnd();
				this.SetVoiceIcon(true);
				break;
			case ChatInputMode.InputSmileyMode:
				this.ShowSmileyIcon(false);
				this.inputTxt.set_Visibility(0);
				this.VoiceSend.set_Visibility(1);
				this.gridInputBoxCover.set_Visibility(0);
				this.mIsDelayShowSmiley = true;
				this.sipStart();
				this.showSmileyPopUp();
				this.SetVoiceIcon(false);
				break;
			case ChatInputMode.InputDefault:
			{
				this.ShowSmileyIcon(true);
				object focusedElement = FocusManager.GetFocusedElement();
				if (focusedElement == this.inputTxt.realBox)
				{
					this.SmileySwitchBtn.Focus();
				}
				this.sipEnd();
				this.hideSmileyPopUp();
				break;
			}
			default:
				this.ShowSmileyIcon(true);
				this.inputTxt.set_Visibility(0);
				this.VoiceSend.set_Visibility(1);
				this.gridInputBoxCover.set_Visibility(0);
				this.hideSmileyPopUp();
				this.sipEnd();
				this.SetVoiceIcon(false);
				break;
			}
			this.RefreshChatListLayoutForSip();
		}
		private void RefreshChatListLayoutForSip()
		{
		}
		private bool IsSipOpen()
		{
			return this.mSipHeight > 0.001;
		}
		public void RootFrameChange(double double_0)
		{
			this.UpdateTopMargin(double_0);
			this.mSipHeight = double_0;
		}
		private void SetVoiceIcon(bool isVoice)
		{
			if (this.VoiceSwitchBtn == null)
			{
				return;
			}
			if (isVoice == this.isCurrentVoiceIcon)
			{
				return;
			}
			if (isVoice)
			{
				this.gridInputBoxCover.set_Visibility(1);
				this.VoiceSwitchBtn.ImageSource = (new ImageSourceConverter().ConvertFromString("/Resource/Img/Chat/messeage_icon.png") as ImageSource);
			}
			else
			{
				this.gridInputBoxCover.set_Visibility(0);
				this.VoiceSwitchBtn.ImageSource = (new ImageSourceConverter().ConvertFromString("/Resource/Img/Chat/voice.png") as ImageSource);
			}
			this.isCurrentVoiceIcon = isVoice;
		}
		public bool IsPagePopUped()
		{
			return this.mBIsSipStarted;
		}
		private void sipStart()
		{
			this.mBIsSipStarted = true;
			this.setNowTranslate(408.0);
			if (this.mDlgOnStartPushPage != null)
			{
				this.mDlgOnStartPushPage(null, null);
			}
		}
		private void sipEnd()
		{
			this.mBIsSipStarted = false;
			this.setNowTranslate(0.0);
			if (this.mDlgOnEndPushPage != null)
			{
				this.mDlgOnEndPushPage(null, null);
			}
		}
		private void initSmileyPopUp()
		{
			if (this.mPopSmileyView != null)
			{
				return;
			}
			this.mPopSmileyView = new Popup();
			if (this.SmileyView == null)
			{
				this.InitSmiley();
			}
			this.mPopSmileyView.set_Child(this.SmileyView);
			this.mPopSmileyView.set_VerticalOffset(392.0);
		}
		private void showSmileyPopUp()
		{
			if (this.mPopSmileyView == null)
			{
				this.initSmileyPopUp();
				base.get_Dispatcher().BeginInvoke(delegate
				{
					this.mPopSmileyView.set_IsOpen(true);
				});
				return;
			}
			this.mPopSmileyView.set_IsOpen(true);
		}
		private void hideSmileyPopUp()
		{
			if (this.mPopSmileyView == null)
			{
				return;
			}
			this.mPopSmileyView.set_IsOpen(false);
		}
		private void setNowTranslate(double height)
		{
			this.mDNowTranslayte = height;
			this.setPageTranslate(this.mDNowTranslayte);
		}
		private void UpdateTopMargin(double translateY)
		{
			this.setPageTranslate(this.mDNowTranslayte);
		}
		private void setPageTranslate(double double_0)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			if (phoneApplicationFrame != null)
			{
				TransformGroup transformGroup = phoneApplicationFrame.get_RenderTransform() as TransformGroup;
				if (transformGroup != null)
				{
					TranslateTransform translateTransform = transformGroup.get_Children().get_Item(0) as TranslateTransform;
					translateTransform.set_Y(-double_0);
				}
			}
		}
		private void InitSmiley()
		{
			this.SmileyView = new SmileyOverlay();
			this.SmileyView.Click = new SmileyClick(this.SmileyClick);
			this.SmileyView.EmojiClick = new SmileyClick(this.EmojiClick);
			this.SmileyView.bIsWithoutArtSmiley = this.bIsWithoutArtSmiley;
			this.SmileyView.mmInputer = this;
		}
		private void SmileyClick(int smiley)
		{
			if (smiley == -1)
			{
				this.DoSend();
				return;
			}
			if (smiley != -2)
			{
				int selectionStart = this.inputTxt.realBox.get_SelectionStart();
				string text = this.inputTxt.Text;
				string text2 = text.Substring(0, selectionStart);
				string smileyText = SmileyManager.GetInstance().getSmileyText(smiley);
				this.SmileyView.PushSmileyStack(smileyText);
				string text3 = text2 + smileyText;
				int length = text3.get_Length();
				text3 += text.Substring(selectionStart);
				this.inputTxt.Text = text3;
				this.inputTxt.realBox.set_SelectionStart(length);
				this.inputTxt.realBox.set_SelectionLength(0);
				return;
			}
			if (this.inputTxt.realBox.get_SelectionLength() > 0)
			{
				int selectionStart2 = this.inputTxt.realBox.get_SelectionStart();
				int selectionLength = this.inputTxt.realBox.get_SelectionLength();
				string text4 = this.inputTxt.Text;
				string text5 = text4.Substring(0, selectionStart2) + text4.Substring(selectionStart2 + selectionLength);
				this.inputTxt.Text = text5;
				this.inputTxt.realBox.set_SelectionStart(selectionStart2);
				this.inputTxt.realBox.set_SelectionLength(0);
				return;
			}
			int selectionStart3 = this.inputTxt.realBox.get_SelectionStart();
			string text6 = this.inputTxt.Text;
			string text7 = text6.Substring(0, selectionStart3);
			string text8 = this.SmileyView.RemoveLastSmiley(text7);
			int num = text7.get_Length() - text8.get_Length();
			text7 = text8 + text6.Substring(selectionStart3);
			this.inputTxt.Text = text7;
			this.inputTxt.realBox.set_SelectionStart(selectionStart3 - num);
			this.inputTxt.realBox.set_SelectionLength(0);
		}
		private void EmojiClick(int emojiIndex)
		{
			int selectionStart = this.inputTxt.realBox.get_SelectionStart();
			string text = this.inputTxt.Text;
			string text2 = text.Substring(0, selectionStart);
			string utf16CodeByIndex = EmojiManager.GetInstance().GetUtf16CodeByIndex(emojiIndex);
			this.SmileyView.PushSmileyStack(utf16CodeByIndex);
			string text3 = text2 + utf16CodeByIndex;
			int length = text3.get_Length();
			text3 += text.Substring(selectionStart);
			this.inputTxt.Text = text3;
			this.inputTxt.realBox.set_SelectionStart(length);
			this.inputTxt.realBox.set_SelectionLength(0);
		}
		private static void OnRenderXPropertyChanged(DependencyObject dependencyObject_0, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs_0)
		{
			((MMInputer)dependencyObject_0).UpdateTopMargin((double)dependencyPropertyChangedEventArgs_0.get_NewValue());
		}
		private void BindToKeyboardFocus()
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			if (phoneApplicationFrame != null)
			{
				TransformGroup transformGroup = phoneApplicationFrame.get_RenderTransform() as TransformGroup;
				if (transformGroup != null)
				{
					TranslateTransform source = transformGroup.get_Children().get_Item(0) as TranslateTransform;
					Binding binding = new Binding("Y");
					binding.set_Source(source);
					base.SetBinding(MMInputer.TranslateYProperty, binding);
				}
			}
		}
		private void UnBindToKeyboardFocus()
		{
			this.TranslateY = 0.0;
			this.setNowTranslate(0.0);
		}
		private void mPage_BackKeyPress(object sender, CancelEventArgs e)
		{
			if (this.mBIsSipStarted)
			{
				this.SwitchMode(ChatInputMode.InputDefault, false);
				e.set_Cancel(true);
			}
		}
		private void setBackKeyHandler()
		{
			if (this.mBIsSetBackKey)
			{
				return;
			}
			PhoneApplicationPage currPage = this.getCurrPage();
			if (currPage != null)
			{
				this.mPage.add_BackKeyPress(new EventHandler<CancelEventArgs>(this.mPage_BackKeyPress));
				this.mBIsSetBackKey = true;
			}
		}
		private void unSetBackKeyHandler()
		{
			if (this.mBIsSetBackKey)
			{
				PhoneApplicationPage phoneApplicationPage = this.mPage;
				if (phoneApplicationPage != null)
				{
					this.mPage.remove_BackKeyPress(new EventHandler<CancelEventArgs>(this.mPage_BackKeyPress));
					this.mBIsSetBackKey = false;
				}
			}
		}
		private void clearCurrPage()
		{
			this.mPage = null;
		}
		private PhoneApplicationPage getCurrPage()
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			if (phoneApplicationFrame != null)
			{
				PhoneApplicationPage phoneApplicationPage = phoneApplicationFrame.get_Content() as PhoneApplicationPage;
				if (phoneApplicationPage != null)
				{
					this.mPage = phoneApplicationPage;
				}
			}
			return this.mPage;
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/CommonUseControl/MMInputer.xaml", 2));
			this.inputBk = (StackPanel)base.FindName("inputBk");
			this.VoiceSwitchBtn = (RoundButton)base.FindName("VoiceSwitchBtn");
			this.gridInputArea = (Grid)base.FindName("gridInputArea");
			this.VoiceSend = (VoiceInputButton)base.FindName("VoiceSend");
			this.inputTxt = (ChatInputTextBox)base.FindName("inputTxt");
			this.gridInputBoxCover = (Grid)base.FindName("gridInputBoxCover");
			this.SmileySwitchBtn = (RoundButton)base.FindName("SmileySwitchBtn");
			this.VoiceHintBlock = (VoiceHint)base.FindName("VoiceHintBlock");
		}
	}
}
